package com.code.aspectj.util;

import android.os.SystemClock;
import android.view.View;

/**
 * Created by RLZ
 * on 2021/12/6
 */
public class ClickUtils {

    private static long mLastClickTime;
    private static int mLastClickViewId;


    /**
     * 是否快速点击
     */
    public static boolean isFastClick(View view, long intervalMillis) {
        int viewId = view.getId();
        long time = SystemClock.elapsedRealtime();
        long timeInterval = Math.abs(time - mLastClickTime);
        if (timeInterval < intervalMillis && viewId == mLastClickViewId) {
            return true;
        } else {
            mLastClickTime = time;
            mLastClickViewId = viewId;
            return false;
        }
    }
}
